package com.virtual.rerijaapps.pet.ui;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.GregorianCalendar;

import org.joda.time.LocalDate;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import be.billington.calendar.recurrencepicker.RecurrencePickerDialog;
import be.billington.calendar.recurrencepicker.RecurrencePickerDialog.OnRecurrenceSetListener;

import com.androidquery.AQuery;
import com.dd.processbutton.iml.ActionProcessButton;
import com.google.ical.compat.jodatime.LocalDateIterable;
import com.google.ical.compat.jodatime.LocalDateIteratorFactory;
import com.tripadvisor.seekbar.CircularClockSeekBar;
import com.tripadvisor.seekbar.CircularClockSeekBar.OnSeekBarChangeListener;
import com.virtual.rerijaapps.pet.PrincipalScreen;
import com.virtual.rerijaapps.pet.R;

public class DialogProgressButton extends RelativeLayout
{

	private Context mContext;
	
	public AQuery mAquery;
	
	public DialogProgressButton( Context context )
	{
		super( context, null );
		mContext = context;
		init( context, null );
	}

	public DialogProgressButton( Context context, AttributeSet attrs )
	{
		super( context, attrs );
		init( context, attrs );
	}

	public DialogProgressButton( Context context, AttributeSet attrs, int defStyle )
	{
		super( context, attrs, defStyle );
		init( context, attrs );
	}
	
	public void init( Context context, AttributeSet attrs )
	{
		mContext = context;
		View rootView = View.inflate( mContext , R.layout.dialog_progress_button, this );
		if ( !isInEditMode() )
		{
			mAquery = new AQuery( rootView );
			( ( ActionProcessButton ) mAquery.id( R.id.working_button ).getView() ).setMode( ActionProcessButton.Mode.ENDLESS );
			( ( ActionProcessButton ) mAquery.id( R.id.working_button ).getView() ).setProgress( 50 );
		}
	}
	
	public void setComplete()
	{
		mAquery.id( R.id.working_button ).clicked( this, "clickComplete" );
		( ( ActionProcessButton ) mAquery.id( R.id.working_button ).getView() ).setProgress( 100 );
	}
	
	public void clickComplete( View view )
	{
		( ( PrincipalScreen ) mContext ).showLoadingDialog( false );
	}
}
